package com.service.Authorization.service.impl;

import com.service.Authorization.entity.QyProgrammeApiBind;
import com.service.Authorization.dao.QyProgrammeApiBindDao;
import com.service.Authorization.service.QyProgrammeApiBindService;
import com.service.Authorization.vo.QyCorpInfoVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * (QyProgrammeApiBind)表服务实现类
 *
 * @author makejava
 * @since 2021-09-09 15:42:02
 */
@Service("qyProgrammeApiBindService")
public class QyProgrammeApiBindServiceImpl implements QyProgrammeApiBindService {
    @Resource
    private QyProgrammeApiBindDao qyProgrammeApiBindDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id
     * @return 实例对象
     */
    @Override
    public List<QyProgrammeApiBind> queryById(String id,String manageId) {
        return this.qyProgrammeApiBindDao.queryById(id,manageId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<QyProgrammeApiBind> queryAllByLimit(int offset, int limit) {
        return this.qyProgrammeApiBindDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param qyProgrammeApiBind 实例对象
     * @return 实例对象
     */
    @Override
    public QyProgrammeApiBind insert(QyProgrammeApiBind qyProgrammeApiBind) {
        this.qyProgrammeApiBindDao.insert(qyProgrammeApiBind);
        return qyProgrammeApiBind;
    }

    /**
     * 修改数据
     *
     * @param qyProgrammeApiBind 实例对象
     * @return 实例对象
     */
    @Override
    public QyProgrammeApiBind update(QyProgrammeApiBind qyProgrammeApiBind) {
        this.qyProgrammeApiBindDao.update(qyProgrammeApiBind);
        return qyProgrammeApiBind;
    }

    /**
     * 通过主键删除数据
     *
     * @param id
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.qyProgrammeApiBindDao.deleteById(id) > 0;
    }

    @Override
    public List<QyProgrammeApiBind> queryAll(QyProgrammeApiBind qyProgrammeApiBind) {
        return qyProgrammeApiBindDao.queryAll(qyProgrammeApiBind);
    }
    /**
     * 批量删除
     * @param qyProgrammeApiBindList1
     * @return
     */
    @Override
    @Transactional
    public void deleteBatch(List<QyProgrammeApiBind> qyProgrammeApiBindList1) {
        qyProgrammeApiBindDao.deleteBatch(qyProgrammeApiBindList1);
    }

    /**
     * 批量插入
     * @param qyProgrammeApiBindList
     * @return
     */
    @Override
    @Transactional
    public int insertBatch(List<QyProgrammeApiBind> qyProgrammeApiBindList) {
        return qyProgrammeApiBindDao.insertOrUpdateBatch(qyProgrammeApiBindList);
    }
    /**
     * 删除绑定信息
     * @param qyCorpInfoVo
     * @return
     */
    @Override
    public int cancelQyCorpInfoBindApi(QyCorpInfoVo qyCorpInfoVo) {
        return qyProgrammeApiBindDao.cancelQyCorpInfoBindApi(qyCorpInfoVo);
    }

    @Override
    public void deleteByQyCorpInfoId(String qyCorpInfoId, String userId) {
        qyProgrammeApiBindDao.deleteByQyCorpInfoId(qyCorpInfoId,userId);
    }

    @Override
    public void updateBatch(List<QyProgrammeApiBind> qyProgrammeApiBindList) {
        qyProgrammeApiBindDao.updateBatch(qyProgrammeApiBindList);
    }

    @Override
    public void update1(QyProgrammeApiBind qyProgrammeApiBind) {
        qyProgrammeApiBindDao.update1(qyProgrammeApiBind);
    }

    @Override
    public QyProgrammeApiBind find(String programmeInfoId, String manageId, String corpInfoId) {
        return qyProgrammeApiBindDao.programmeInfoId(programmeInfoId,manageId,corpInfoId);
    }
}
